<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex两横棋盘布局.html</title>
</head>

<body>
    <div class="box">
        <div class="column">
            <div class="item">
                <h3>1</h3>666
            </div>
            <div class="item">
                <h3>2</h3>666
            </div>
        </div>
        <div class="column">
            <div class="item">
                <h3>3</h3>666
            </div>
            <div class="item">
                <h3>4</h3>666
            </div>
        </div>
    </div>
    <style>
        .box {
            display: flex;
            flex-wrap: wrap;
            align-content: space-between;
        }

        .column {
            flex-basis: 100%;
            display: flex;
            /*两端居中对齐,仅包含子元素*/
            /*justify-content: space-between;*/
            /*垂直居中,仅包含子元素*/
            /*align-items: center;   */
        }

        .item {
            width: 50%;
            text-align: center;
            height: auto;
            border: 2px solid rgb(255, 255, 255);
        }

        /*奇数*/
        .column :nth-child(odd) {
            background-color: tomato;
        }

        /*偶数*/
        .column :nth-child(even) {
            background-color: teal;
        }
    </style>
</body>

</html>